import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeaseInformationVO, LeaseInformationForm, LeaseInformationQuery } from '@/api/zichcanguanli/leaseInformation/types';

/**
 * 查询土地租赁信息列表
 * @param query
 * @returns {*}
 */

export const listLeaseInformation = (query?: LeaseInformationQuery): AxiosPromise<LeaseInformationVO[]> => {
  return request({
    url: '/zichanguanli/leaseInformation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询土地租赁信息详细
 * @param landInfoId
 */
export const getLeaseInformation = (landInfoId: string | number): AxiosPromise<LeaseInformationVO> => {
  return request({
    url: '/zichanguanli/leaseInformation/' + landInfoId,
    method: 'get'
  });
};

/**
 * 新增土地租赁信息
 * @param data
 */
export const addLeaseInformation = (data: LeaseInformationForm) => {
  return request({
    url: '/zichanguanli/leaseInformation',
    method: 'post',
    data: data
  });
};

/**
 * 修改土地租赁信息
 * @param data
 */
export const updateLeaseInformation = (data: LeaseInformationForm) => {
  return request({
    url: '/zichanguanli/leaseInformation',
    method: 'put',
    data: data
  });
};

/**
 * 删除土地租赁信息
 * @param id
 */
export const delLeaseInformation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichcanguanli/leaseInformation/' + id,
    method: 'delete'
  });
};
